﻿@model Tippelde.Web.Models.News.CreateNewsModel
@{
    string actionName = ViewBag.Action;
}

<div class="modal-dialog">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            <h4 class="modal-title" id="modalTitle">Hír @(actionName == "Edit" ? "módosítása" : "hozzáadása")</h4>
        </div>

        @using (Html.BeginForm(actionName, "News", FormMethod.Post, new { @class = "form-vertical" }))
        {
            @Html.ValidationSummary();
            @Html.AntiForgeryToken();
            <div class="modal-body">
                <fieldset>
                    @Html.HiddenFor(m => m.Id)
                    <div class="col-lg-12">
                        <div class="form-group">
                            <div class="col-lg-12">
                                @Html.TextBoxFor(m => m.Title, new { @class = "form-control", placeholder = "Cím" })
                            </div>
                        </div>

                        <div class="form-group">
                            @Html.LabelFor(m => m.Content, new { @class = "control-label" })
                            <div class="col-lg-12">
                                @Html.TextAreaFor(m => m.Content, new { @class = "form-control text-editor-input", rows = "10" })
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-12">
                        @if (User.IsInRole("newsmanager"))
                        {
                            <div class="form-group">
                                <div class="form-control">


                                    @Html.CheckBoxFor(m => m.AllowAnonym, new { @class = "" })
                                    @Html.LabelFor(m => m.AllowAnonym, new { @class = "" })
                                </div>

                                <div class="form-control">


                                    @Html.CheckBoxFor(m => m.AllowGlobalAuthenticated, new { @class = "" })
                                    @Html.LabelFor(m => m.AllowGlobalAuthenticated, new { @class = "" })
                                </div>
                            </div>
                        }
                        <div class="form-group">
                            @Html.LabelFor(m => m.Groups, new { @class = "control-label" })
                            @{ Html.RenderPartial("_GroupSelector", Model.GroupList, new ViewDataDictionary { { "ModelName", "Groups" } }); }
                        </div>
                    </div>
                </fieldset>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Mégse</button>
                <button type="submit" class="btn btn-primary">Mentés</button>
            </div>
        }

    </div>
</div>
<script src="@Url.Content("~/bundles/jqueryval")"></script>
<script src="@Url.Content("/Scripts/tinymce/tinymce.min.js")"></script>
<script src="@Url.Content("/Scripts/tinymce/jquery.tinymce.min.js")"></script>
<script src="@Url.Content("~/bundles/tippelde-texteditor")"></script>
<script>
    Tippelde.InitTextEditor(".text-editor-input", 500);
</script>